package util;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

import type.IPAddress;

public class IPUtils {
	public static IPAddress getIPAdress(){
		try {
			IPAddress address = new IPAddress(InetAddress.getLocalHost().getHostAddress(), NetworkUtils.getMacAddress());
			return address;
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} 
		return null;
	}
	public static void changeIP(String username,String pwd){
		try {
			Process p = Runtime.getRuntime().exec("rasdial.exe "+username+" "+pwd);
			p.waitFor();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
